X-Git-Url: http://git.cyclocoop.org/%22.%24match%5B1%5D.%22?a=blobdiff_plain;f=includes%2Fhtmlform%2FHTMLFormField.php;h=5f6460d3df57306ca8ef9d0a4f65a1a411371bc9;hb=71e4493c864e4f14f1c850c710be017a7198fd2b;hp=7cb497d11c36f70454fd872e43f1905b65001b7f;hpb=ea8c52b7ce54ef254dc4cf6d867b15b56e21b6fc;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/htmlform/HTMLFormField.php b/includes/htmlform/HTMLFormField.php index 7cb497d11c..5f6460d3df 100644 --- a/includes/htmlform/HTMLFormField.php +++ b/includes/htmlform/HTMLFormField.php @@ -612,11 +612,17 @@ abstract class HTMLFormField { $error = new OOUI\HtmlSnippet( $error ); } + $notices = $this->getNotices(); + foreach ( $notices as &$notice ) { + $notice = new OOUI\HtmlSnippet( $notice ); + } + $config = [ 'classes' => [ "mw-htmlform-field-$fieldType", $this->mClass ], 'align' => $this->getLabelAlignOOUI(), 'help' => $helpText !== null ? new OOUI\HtmlSnippet( $helpText ) : null, 'errors' => $errors, + 'notices' => $notices, 'infusable' => $infusable, ]; @@ -854,6 +860,30 @@ abstract class HTMLFormField { return $errors; } + /** + * Determine notices to display for the field. + * + * @since 1.28 + * @return string[] + */ + function getNotices() { + $notices = []; + + if ( isset( $this->mParams['notice-message'] ) ) { + $notices[] = $this->getMessage( $this->mParams['notice-message'] )->parse(); + } + + if ( isset( $this->mParams['notice-messages'] ) ) { + foreach ( $this->mParams['notice-messages'] as $msg ) { + $notices[] = $this->getMessage( $msg )->parse(); + } + } elseif ( isset( $this->mParams['notice'] ) ) { + $notices[] = $this->mParams['notice']; + } + + return $notices; + } + /** * @return string HTML */